Public Class BatchVendorUpdate

    Public Event BatchUpdate()

    'Private Const ConfirmationMessage As String = "You are about to delete {0} rows. This operation cannot be undone. Do you wish to continue?"

    'Dim deleteCancelled As Boolean = True

    Private Sub BatchVendorUpdate_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.ProviderTableAdapter.Fill(Me.Providers.Provider)
        Me.FilesTableAdapter.Fill(Me.Products.Files)

    End Sub

    Private Sub Update_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpdateBatch.Click

        Try

            Cursor = Cursors.WaitCursor

            FilesDS.EndEdit()
            FilesTableAdapter.Update(Products.Files)

            RaiseEvent BatchUpdate()

            Me.Close()

        Catch ex As Exception
            MsgBox(ex.Message)
        Finally
            Cursor = Cursors.Default
        End Try

    End Sub

    Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click

        FilesDS.CancelEdit()
        Me.Close()

    End Sub

    'Private Sub FilesGrid_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles FilesGrid.Click

    '    'MsgBox(e.ToString)

    'End Sub

    'Private Sub FilesGrid_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles FilesGrid.KeyDown

    '    If e.KeyCode = Keys.Delete Then
    '        Dim response As DialogResult = MessageBox.Show(String.Format(ConfirmationMessage, FilesGrid.SelectedRows.Count), _
    '                                                   "Delete row(s)?", _
    '                                                   MessageBoxButtons.YesNo, _
    '                                                   MessageBoxIcon.Question, _
    '                                                   MessageBoxDefaultButton.Button2)
    '        If (response = DialogResult.No) Then
    '            deleteCancelled = True
    '        Else
    '            deleteCancelled = False
    '        End If
    '    End If

    'End Sub

    'Private Sub FilesGrid_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles FilesGrid.KeyPress

    '    If deleteCancelled Then
    '        e.Handled = True
    '    End If

    'End Sub


    'Private Sub FilesGrid_UserDeletingRow(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowCancelEventArgs) Handles FilesGrid.UserDeletingRow

    '    e.Cancel = deleteCancelled

    'End Sub

End Class